Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The reconnect check still trusts the original certificate, so it can pass even if the reload leaves the old SSL context active and certificate rotation fails.
1 open issue
What changed in this PR
Extends ALTER INSTANCE RELOAD TLS to reload Galera TLS alongside MySQL TLS without changing the parser.
Changes:
- Adds
wsrepandmysql_main_and_wsrepchannels, with automatic cascading when cluster traffic encryption is enabled. - Reports partial failures, disabled Galera TLS, and certificate-path differences.
- Adds Galera tests for reloads, certificate rotation, failure handling, and provider availability.
| File | Description |
|---|---|
sql/wsrep_var.h |
Declares the Galera TLS settings structure and reload interface. |
sql/wsrep_var.cc |
Implements provider TLS reload and settings retrieval. |
sql/sql_admin.cc |
Adds channel routing, cascading, and reload diagnostics. |
mysql-test/suite/galera/t/galera_ssl_reload_tls.test |
Tests explicit channels, failures, and certificate rotation. |
mysql-test/suite/galera/t/galera_ssl_reload_tls.cnf |
Configures two nodes with Galera TLS enabled. |
mysql-test/suite/galera/t/galera_ssl_reload_tls_no_ssl.test |
Tests warnings when Galera TLS is disabled. |
mysql-test/suite/galera/t/galera_ssl_reload_tls_encrypt.test |
Tests cascading, path warnings, and missing-provider behavior. |
mysql-test/suite/galera/t/galera_ssl_reload_tls_encrypt.cnf |
Enables cluster traffic encryption for cascade tests. |
mysql-test/suite/galera/r/galera_ssl_reload_tls.result |
Records expected explicit-channel and rotation results. |
mysql-test/suite/galera/r/galera_ssl_reload_tls_no_ssl.result |
Records expected disabled-TLS warnings. |
mysql-test/suite/galera/r/galera_ssl_reload_tls_encrypt.result |
Records expected cascade results and diagnostics. |
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Live Galera TLS reloads on the default encrypted-cluster path need human validation of multi-node certificate rotation and connection continuity because provider sources and runtime are unavailable in this snapshot.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
…assian.net/browse/PXC-5333 Problem: ALTER INSTANCE RELOAD TLS reloads only the MySQL TLS context. Galera TLS has to be reloaded separately with SET GLOBAL wsrep_provider_options='socket.ssl_reload=1', even when pxc_encrypt_cluster_traffic=ON and Galera uses the MySQL ssl_* files. Resolution: Treat Galera connections as TLS channels, without changing the parser: * FOR CHANNEL wsrep reloads Galera TLS only, with the same locking as socket.ssl_reload. It fails if no provider is loaded, and succeeds with a warning if Galera TLS is disabled (socket.ssl=NO). * FOR CHANNEL mysql_main_and_wsrep reloads mysql_main, then wsrep. If the wsrep part fails, the error says that mysql_main has already been reloaded. NO ROLLBACK ON ERROR applies to the MySQL part only. * With pxc_encrypt_cluster_traffic=ON and a provider configured, plain ALTER INSTANCE RELOAD TLS and FOR CHANNEL mysql_main behave like mysql_main_and_wsrep. * With pxc_encrypt_cluster_traffic=ON, Galera keeps the socket.ssl_* paths set at provider load and only re-reads those files. If ssl_ca, ssl_cert or ssl_key now point elsewhere, a warning is pushed and written to the error log saying a restart is needed. The statement is local to the node (no TOI) and affects new connections only. Like socket.ssl_reload, the Galera reload replaces the certificate and key but only adds to the CA trust store: a CA removed from the socket.ssl_ca file stays trusted until restart. Test: galera.galera_ssl_reload_tls rotates node 1 to a certificate issued by a new, unrelated CA (galera-reload-*.pem in std_data) and restarts node 2 trusting only that CA. Node 2 can rejoin only if node 1 presents the reloaded certificate, so the test fails if the reload is not applied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

https://perconadev.atlassian.net/browse/PXC-5333
ALTER INSTANCE RELOAD TLS for Galera
Problem
The
ALTER INSTANCE RELOAD TLScommand reloads the MySQL SSL-related variables (ssl_ca,ssl_cert,ssl_key). TheSET GLOBAL wsrep_provider_options='socket.ssl_reload=1'command reloads the Galera SSL parameters (socket.ssl_ca,socket.ssl_cert,socket.ssl_key).We should have one command that reloads both, or the MySQL reload should cascade to Galera. The cascade could be turned on when
pxc_encrypt_cluster_trafficis enabled.We want to avoid modifying the parser.
Solution
The idea is to treat Galera connections as a TLS channel named
wsrep, in the same way as the MySQL channelsmysql_mainandmysql_admin(see https://dev.mysql.com/doc/refman/9.7/en/alter-instance.html).1. Channel
wsrepGalera SSL options are reloaded by:
This does the same as
SET GLOBAL wsrep_provider_options='socket.ssl_reload=1', with the same locking.socket.ssl=NO), Galera does nothing. The statement succeeds with a warning saying that Galera TLS is not enabled.2. Channel
mysql_main_and_wsrepGalera SSL options are reloaded together with the MySQL ones for the main channel through an artificial channel that combines
mysql_mainandwsrep:This lets users reload both with a single command without changing the meaning of the existing commands.
3. Partial failure
Although it is a single command, reloading
mysql_main_and_wsrepruns two separate operations:mysql_mainfirst, thenwsrep. The first one can succeed while the second one fails. In that case:an error is returned;
the error text says that
mysql_mainhas already been reloaded, so the user knows the statement was partially applied. For example:after fixing the problem, the user only needs to repeat the Galera part (
FOR CHANNEL wsrep).If the
mysql_mainreload fails,wsrepis not attempted and the usual MySQL error is returned.NO ROLLBACK ON ERRORapplies only to the MySQL part. Awsrepfailure is always an error.The same rules apply to the cascade described in point 4.
4. Cascade when
pxc_encrypt_cluster_traffic = ONWhen
pxc_encrypt_cluster_traffic = ONand a wsrep provider is configured, both plainALTER INSTANCE RELOAD TLSandALTER INSTANCE RELOAD TLS FOR CHANNEL mysql_mainbehave likeFOR CHANNEL mysql_main_and_wsrep: MySQL TLS is reloaded first, then Galera TLS.This changes the meaning of the existing command. It is the behavior users who set this flag are likely to expect, because Galera SSL is then configured from the MySQL
ssl_*options.When
pxc_encrypt_cluster_traffic = OFF, Galera has its own SSL configuration andmysql_mainreloads MySQL only, as in upstream MySQL.4.1 Accepted limitation:
mysql_maincannot be reloaded aloneThe parser maps plain
ALTER INSTANCE RELOAD TLSto the channel namemysql_main. So without a parser change, the plain form cannot be told apart from an explicitFOR CHANNEL mysql_main. As a result, withpxc_encrypt_cluster_traffic = ON:mysql_mainchannel without also reloading Galera;mysql_mainandmysql_main_and_wsrepbehave the same.We accept this limitation to keep the parser unchanged.
4.2 Galera keeps its startup paths
With
pxc_encrypt_cluster_traffic = ON, the Galera optionssocket.ssl_key,socket.ssl_caandsocket.ssl_certare filled from the MySQL optionsssl_key,ssl_caandssl_certonce, when the provider is loaded. Galera marks these options read-only, so they cannot be changed at runtime.socket.ssl_reloadre-reads the files at the paths set at startup.Only rotating certificates in place (new content, same file path) is supported for Galera. If the MySQL paths were changed at runtime, for example:
MySQL loads the new file, but Galera re-reads the old one. To make this visible instead of silent:
pxc_encrypt_cluster_traffic = ON(through the cascade,mysql_main_and_wsreporwsrep), the currentssl_key,ssl_caandssl_certvalues are compared with the remembered Galera paths.The check does not raise an error. An error would block MySQL TLS reloads (see 4.1) until the server is restarted.
Only
ssl_key,ssl_caandssl_certare passed to Galera. Changes to other MySQL TLS options (ssl_capath,ssl_crl,ssl_cipher,tls_version, ...) never affect Galera.5. Privileges
ALTER INSTANCE RELOAD TLSneedsCONNECTION_ADMIN. The existing Galera route (SET GLOBAL wsrep_provider_options) needsSYSTEM_VARIABLES_ADMIN. Through the new channels, a user with onlyCONNECTION_ADMINcan reload Galera TLS. We accept this.6. Scope
ALTER INSTANCEis not replicated (no TOI). The statement must be run on every node of the cluster.performance_schemarow.performance_schema.tls_channel_statusdoes not list thewsrepchannel. This may be added later.